home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / X11R4 / cmds / X / include / servermd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-03-04  |  9.4 KB  |  297 lines

  1. /***********************************************************
  2. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  3. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  4.  
  5.                         All Rights Reserved
  6.  
  7. Permission to use, copy, modify, and distribute this software and its 
  8. documentation for any purpose and without fee is hereby granted, 
  9. provided that the above copyright notice appear in all copies and that
  10. both that copyright notice and this permission notice appear in 
  11. supporting documentation, and that the names of Digital or MIT not be
  12. used in advertising or publicity pertaining to distribution of the
  13. software without specific, written prior permission.  
  14.  
  15. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  16. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  17. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  18. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  19. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  20. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21. SOFTWARE.
  22.  
  23. ******************************************************************/
  24. #ifndef SERVERMD_H
  25. #define SERVERMD_H 1
  26. /* $XConsortium: servermd.h,v 1.48 89/12/06 16:56:14 rws Exp $ */
  27.  
  28. /*
  29.  * The vendor string identifies the vendor responsible for the
  30.  * server executable.
  31.  */
  32. #ifndef VENDOR_STRING
  33. #define VENDOR_STRING "SpriteOS, UCB"
  34. #endif
  35.  
  36. /*
  37.  * The vendor release number identifies, for the purpose of submitting
  38.  * traceable bug reports, the release number of software produced
  39.  * by the vendor.
  40.  */
  41. #ifndef VENDOR_RELEASE
  42. #define VENDOR_RELEASE    4
  43. #endif
  44.  
  45. /*
  46.  * Machine dependent values:
  47.  * GLYPHPADBYTES should be chosen with consideration for the space-time
  48.  * trade-off.  Padding to 0 bytes means that there is no wasted space
  49.  * in the font bitmaps (both on disk and in memory), but that access of
  50.  * the bitmaps will cause odd-address memory references.  Padding to
  51.  * 2 bytes would ensure even address memory references and would
  52.  * be suitable for a 68010-class machine, but at the expense of wasted
  53.  * space in the font bitmaps.  Padding to 4 bytes would be good
  54.  * for real 32 bit machines, etc.  Be sure that you tell the font
  55.  * compiler what kind of padding you want because its defines are
  56.  * kept separate from this.  See server/include/font.h for how
  57.  * GLYPHPADBYTES is used.
  58.  *
  59.  * Along with this, you should choose an appropriate value for
  60.  * GETLEFTBITS_ALIGNMENT, which is used in ddx/mfb/maskbits.h.  This
  61.  * constant choses what kind of memory references are guarenteed during
  62.  * font access; either 1, 2 or 4, for byte, word or longword access,
  63.  * respectively.  For instance, if you have decided to to have
  64.  * GLYPHPADBYTES == 4, then it is pointless for you to have a
  65.  * GETLEFTBITS_ALIGNMENT > 1, because the padding of the fonts has already
  66.  * guarenteed you that your fonts are longword aligned.  On the other
  67.  * hand, even if you have chosen GLYPHPADBYTES == 1 to save space, you may
  68.  * also decide that the computing involved in aligning the pointer is more
  69.  * costly than an odd-address access; you choose GETLEFTBITS_ALIGNMENT == 1.
  70.  *
  71.  * Next, choose the tuning parameters which are appropriate for your
  72.  * hardware; these modify the behaviour of the raw frame buffer code
  73.  * in ddx/mfb and ddx/cfb.  Defining these incorrectly will not cause
  74.  * the server to run incorrectly, but defining these correctly will
  75.  * cause some noticeable speed improvements:
  76.  *
  77.  *  AVOID_MEMORY_READ - (8-bit cfb only)
  78.  *    When stippling pixels on the screen (polytext and pushpixels),
  79.  *    don't read long words from the display and mask in the
  80.  *    appropriate values.  Rather, perform multiple byte/short/long
  81.  *    writes as appropriate.  This option uses many more instructions
  82.  *    but runs much faster when the destination is much slower than
  83.  *    the CPU and at least 1 level of write buffer is availible (2
  84.  *    is much better).  Defined currently for SPARC and MIPS.
  85.  *
  86.  *  FAST_CONSTANT_OFFSET_MODE - (cfb and mfb)
  87.  *    This define is used on machines which have no auto-increment
  88.  *    addressing mode, but do have an effectively free constant-offset
  89.  *    addressing mode.  Only MIPS uses this currently.
  90.  *    
  91.  *  LARGE_INSTRUCTION_CACHE -
  92.  *    This define increases the number of times some loops are
  93.  *    unrolled.  On 68020 machines (with 256 bytes of i-cache),
  94.  *    this define will slow execution down as instructions miss
  95.  *    the cache frequently.  On machines with real i-caches, this
  96.  *    reduces loop overhead, causing a slight performance improvement.
  97.  *    Currently defined for MIPS and SPARC
  98.  */
  99.  
  100. #ifdef sprite
  101.  
  102. #ifdef sun3
  103. #define IMAGE_BYTE_ORDER    MSBFirst
  104. #define BITMAP_BIT_ORDER    MSBFirst
  105. #define    GLYPHPADBYTES        4
  106. #define GETLEFTBITS_ALIGNMENT    1
  107. #endif
  108.  
  109. #ifdef sun4
  110. #define IMAGE_BYTE_ORDER    MSBFirst
  111. #define BITMAP_BIT_ORDER    MSBFirst
  112. #define AVOID_MEMORY_READ
  113. #define LARGE_INSTRUCTION_CACHE
  114. #define    GLYPHPADBYTES        4
  115. #define GETLEFTBITS_ALIGNMENT    1
  116. #endif
  117.  
  118. #ifdef ds3100
  119. #define AVOID_MEMORY_READ
  120. #define FAST_CONSTANT_OFFSET_MODE
  121. #define LARGE_INSTRUCTION_CACHE
  122. #define IMAGE_BYTE_ORDER    LSBFirst
  123. #define BITMAP_BIT_ORDER    LSBFirst
  124. #define GLYPHPADBYTES        4
  125. #define GETLEFTBITS_ALIGNMENT    1
  126. #endif
  127.  
  128. #else /* sprite (we comment out the whole rest...) */
  129.  
  130. #ifdef vax
  131.  
  132. #define IMAGE_BYTE_ORDER    LSBFirst        /* Values for the VAX only */
  133. #define BITMAP_BIT_ORDER    LSBFirst
  134. #define    GLYPHPADBYTES        1
  135. #define GETLEFTBITS_ALIGNMENT    4
  136.  
  137. #endif /* vax */
  138.  
  139. #if defined(sun)
  140.  
  141. #if defined(sun386) || defined(sun5)
  142. # define IMAGE_BYTE_ORDER    LSBFirst        /* Values for the SUN only */
  143. # define BITMAP_BIT_ORDER    LSBFirst
  144. #else
  145. # define IMAGE_BYTE_ORDER    MSBFirst        /* Values for the SUN only */
  146. # define BITMAP_BIT_ORDER    MSBFirst
  147. #endif
  148.  
  149. #ifdef sparc
  150. # define AVOID_MEMORY_READ
  151. # define LARGE_INSTRUCTION_CACHE
  152. #endif
  153.  
  154. #define    GLYPHPADBYTES        4
  155. #define GETLEFTBITS_ALIGNMENT    1
  156.  
  157. #endif /* sun */
  158.  
  159. #ifdef apollo
  160.  
  161. #define IMAGE_BYTE_ORDER    MSBFirst        /* Values for the Apollo only*/
  162. #define BITMAP_BIT_ORDER    MSBFirst
  163. #define    GLYPHPADBYTES        2
  164. #define GETLEFTBITS_ALIGNMENT    4
  165.  
  166. #endif /* apollo */
  167.  
  168. #if defined(ibm032) || defined (ibm)
  169.  
  170. #ifdef i386
  171. # define IMAGE_BYTE_ORDER    LSBFirst    /* Value for PS/2 only */
  172. #else
  173. # define IMAGE_BYTE_ORDER    MSBFirst        /* Values for the RT only*/
  174. #endif
  175. #define BITMAP_BIT_ORDER    MSBFirst
  176. #define    GLYPHPADBYTES        1
  177. #define GETLEFTBITS_ALIGNMENT    4
  178. /* ibm pcc doesn't understand pragmas. */
  179.  
  180. #endif /* ibm */
  181.  
  182. #ifdef hpux
  183.  
  184. #define IMAGE_BYTE_ORDER    MSBFirst        /* Values for the HP only */
  185. #define BITMAP_BIT_ORDER    MSBFirst
  186. #define    GLYPHPADBYTES        4
  187. #define    GETLEFTBITS_ALIGNMENT    1
  188.  
  189. #endif /* hpux */
  190.  
  191. #if defined(M4315) || defined(M4317) || defined(M4319) || defined(M4330)
  192.  
  193. #define IMAGE_BYTE_ORDER    MSBFirst        /* Values for Pegasus only */
  194. #define BITMAP_BIT_ORDER    MSBFirst
  195. #define GLYPHPADBYTES        4
  196. #define GETLEFTBITS_ALIGNMENT    1
  197.  
  198. #endif /* tektronix */
  199.  
  200. #ifdef macII
  201.  
  202. #define IMAGE_BYTE_ORDER          MSBFirst        /* Values for the MacII only */
  203. #define BITMAP_BIT_ORDER          MSBFirst
  204. #define GLYPHPADBYTES             4
  205. #define GETLEFTBITS_ALIGNMENT     1
  206.  
  207. #endif /* macII */
  208.  
  209. #ifdef mips
  210.  
  211. #ifdef MIPSEL
  212. # define IMAGE_BYTE_ORDER    LSBFirst        /* Values for the PMAX only */
  213. # define BITMAP_BIT_ORDER    LSBFirst
  214. # define GLYPHPADBYTES        4
  215. # define GETLEFTBITS_ALIGNMENT    1
  216. #else
  217. # define IMAGE_BYTE_ORDER    MSBFirst        /* Values for the MIPS only */
  218. # define BITMAP_BIT_ORDER    MSBFirst
  219. # define GLYPHPADBYTES        4
  220. # define GETLEFTBITS_ALIGNMENT    1
  221. #endif
  222.  
  223. #define AVOID_MEMORY_READ
  224. #define FAST_CONSTANT_OFFSET_MODE
  225. #define LARGE_INSTRUCTION_CACHE
  226.  
  227. #endif /* mips */
  228.  
  229. #ifdef stellar
  230.  
  231. #define IMAGE_BYTE_ORDER    MSBFirst       /* Values for the stellar only*/
  232. #define BITMAP_BIT_ORDER    MSBFirst
  233. #define    GLYPHPADBYTES        4
  234. #define GETLEFTBITS_ALIGNMENT    4
  235. /*
  236.  * Use SysV random number generator.
  237.  */
  238. #define random rand
  239.  
  240. #endif /* stellar */
  241.  
  242. #endif /* !sprite */
  243.  
  244. /* size of buffer to use with GetImage, measured in bytes. There's obviously
  245.  * a trade-off between the amount of stack (or whatever ALLOCATE_LOCAL gives
  246.  * you) used and the number of times the ddx routine has to be called.
  247.  * 
  248.  * for a 1024 x 864 bit monochrome screen  with a 32 bit word we get 
  249.  * 8192/4 words per buffer 
  250.  * (1024/32) = 32 words per scanline
  251.  * 2048 words per buffer / 32 words per scanline = 64 scanlines per buffer
  252.  * 864 scanlines / 64 scanlines = 14 buffers to draw a full screen
  253.  */
  254. #if defined(stellar)
  255. #define IMAGE_BUFSIZE        (64*1024)
  256. #else
  257. #define IMAGE_BUFSIZE        8192
  258. #endif
  259.  
  260. /* pad scanline to a longword */
  261. #if defined(ibm) && defined(i386)
  262. #define BITMAP_SCANLINE_UNIT    8
  263. #else
  264. #define BITMAP_SCANLINE_UNIT    32
  265. #endif
  266. #define BITMAP_SCANLINE_PAD  32
  267.  
  268. #define LOG2_BITMAP_PAD        5
  269. #define LOG2_BYTES_PER_SCANLINE_PAD    2
  270.  
  271. /* 
  272.  *   This returns the number of padding units, for depth d and width w.
  273.  * For bitmaps this can be calculated with the macros above.
  274.  * Other depths require either grovelling over the formats field of the
  275.  * screenInfo or hardwired constants.
  276.  */
  277.  
  278. typedef struct _PaddingInfo {
  279.     int     padRoundUp;    /* pixels per pad unit - 1 */
  280.     int    padPixelsLog2;    /* log 2 (pixels per pad unit) */
  281.     int     padBytesLog2;    /* log 2 (bytes per pad unit) */
  282. } PaddingInfo;
  283. extern PaddingInfo PixmapWidthPaddingInfo[];
  284.  
  285. #define PixmapWidthInPadUnits(w, d) \
  286.     (((w) + PixmapWidthPaddingInfo[d].padRoundUp) >> \
  287.     PixmapWidthPaddingInfo[d].padPixelsLog2)
  288.  
  289. /*
  290.  *    Return the number of bytes to which a scanline of the given
  291.  * depth and width will be padded.
  292.  */
  293. #define PixmapBytePad(w, d) \
  294.     (PixmapWidthInPadUnits(w, d) << PixmapWidthPaddingInfo[d].padBytesLog2)
  295.  
  296. #endif /* SERVERMD_H */
  297.